home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_gmp.idb / usr / freeware / info / gmp.info-1.z / gmp.info-1
Text File  |  2001-04-12  |  45KB  |  1,121 lines

  1. This is gmp.info, produced by makeinfo version 4.0 from gmp.texi.
  2.  
  3. INFO-DIR-SECTION GNU libraries
  4. START-INFO-DIR-ENTRY
  5. * gmp: (gmp).                   GNU Multiple Precision Arithmetic Library.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents GNU MP, a library for arbitrary-precision
  9. arithmetic.
  10.  
  11.    Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
  12. Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Foundation.
  27.  
  28. 
  29. File: gmp.info,  Node: Top,  Next: Copying,  Prev: (dir),  Up: (dir)
  30.  
  31. GNU MP
  32. ******
  33.  
  34.    This manual documents how to install and use the GNU multiple
  35. precision arithmetic library, version 3.1.1.
  36.  
  37. * Menu:
  38.  
  39. * Copying::                    GMP Copying Conditions (LGPL).
  40. * Introduction to GMP::        Brief introduction to GNU MP.
  41. * Installing GMP::             How to configure and compile the GMP library.
  42. * GMP Basics::                 What every GMP user should now.
  43. * Reporting Bugs::             How to usefully report bugs.
  44. * Integer Functions::          Functions for arithmetic on signed integers.
  45. * Rational Number Functions::  Functions for arithmetic on rational numbers.
  46. * Floating-point Functions::   Functions for arithmetic on floats.
  47. * Low-level Functions::        Fast functions for natural numbers.
  48. * Random Number Functions::    Functions for generating random numbers.
  49. * BSD Compatible Functions::   All functions found in BSD MP.
  50. * Custom Allocation::          How to customize the internal allocation.
  51.  
  52. * Contributors::           Who brings your this library?
  53. * References::                 Some useful papers and books to read.
  54. * Concept Index::
  55. * Function Index::
  56.  
  57. 
  58. File: gmp.info,  Node: Copying,  Next: Introduction to GMP,  Prev: Top,  Up: Top
  59.  
  60. GNU MP Copying Conditions
  61. *************************
  62.  
  63.    This library is "free"; this means that everyone is free to use it
  64. and free to redistribute it on a free basis.  The library is not in the
  65. public domain; it is copyrighted and there are restrictions on its
  66. distribution, but these restrictions are designed to permit everything
  67. that a good cooperating citizen would want to do.  What is not allowed
  68. is to try to prevent others from further sharing any version of this
  69. library that they might get from you.
  70.  
  71.    Specifically, we want to make sure that you have the right to give
  72. away copies of the library, that you receive source code or else can
  73. get it if you want it, that you can change this library or use pieces
  74. of it in new free programs, and that you know you can do these things.
  75.  
  76.    To make sure that everyone has such rights, we have to forbid you to
  77. deprive anyone else of these rights.  For example, if you distribute
  78. copies of the GNU MP library, you must give the recipients all the
  79. rights that you have.  You must make sure that they, too, receive or
  80. can get the source code.  And you must tell them their rights.
  81.  
  82.    Also, for our own protection, we must make certain that everyone
  83. finds out that there is no warranty for the GNU MP library.  If it is
  84. modified by someone else and passed on, we want their recipients to
  85. know that what they have is not what we distributed, so that any
  86. problems introduced by others will not reflect on our reputation.
  87.  
  88.    The precise conditions of the license for the GNU MP library are
  89. found in the Lesser General Public License that accompany the source
  90. code.
  91.  
  92. 
  93. File: gmp.info,  Node: Introduction to GMP,  Next: Installing GMP,  Prev: Copying,  Up: Top
  94.  
  95. Introduction to GNU MP
  96. **********************
  97.  
  98.    GNU MP is a portable library written in C for arbitrary precision
  99. arithmetic on integers, rational numbers, and floating-point numbers.
  100. It aims to provide the fastest possible arithmetic for all applications
  101. that need higher precision than is directly supported by the basic C
  102. types.
  103.  
  104.    Many applications use just a few hundred bits of precision; but some
  105. applications may need thousands or even millions of bits.  GMP is
  106. designed to give good performance for both, by choosing algorithms
  107. based on the sizes of the operands, and by carefully keeping the
  108. overhead at a minimum.
  109.  
  110.    The speed of GMP is achieved by using fullwords as the basic
  111. arithmetic type, by using sophisticated algorithms, by including
  112. carefully optimized assembly code for the most common inner loops for
  113. many different CPUs, and by a general emphasis on speed (as opposed to
  114. simplicity or elegance).
  115.  
  116.    There is carefully optimized assembly code for these CPUs: ARM, DEC
  117. Alpha 21064, 21164, and 21264, AMD 29000, AMD K6 and Athlon, Hitachi
  118. SuperH and SH-2, HPPA 1.0, 1.1 and 2.0, Intel Pentium, Pentium
  119. Pro/Pentium II, generic x86, Intel i960, Motorola MC68000, MC68020,
  120. MC88100, and MC88110, Motorola/IBM PowerPC 32 and 64, National NS32000,
  121. IBM POWER, MIPS R3000, R4000, SPARCv7, SuperSPARC, generic SPARCv8,
  122. UltraSPARC, DEC VAX, and Zilog Z8000.  Some optimizations also for
  123. Clipper, IBM ROMP (RT), and Pyramid AP/XP.
  124.  
  125.    There is a mailing list for GMP users.  To join it, send a mail to
  126. <gmp-request@swox.com> with the word `subscribe' in the message *body*
  127. (not in the subject line).
  128.  
  129.    For up-to-date information on GMP, please see the GMP Home Pages at
  130. `http://www.swox.com/gmp/'.
  131.  
  132. How to use this Manual
  133. ======================
  134.  
  135.    Everyone should read *Note GMP Basics::.  If you need to install the
  136. library yourself, you need to read *Note Installing GMP::, too.
  137.  
  138.    The rest of the manual can be used for later reference, although it
  139. is probably a good idea to glance through it.
  140.  
  141. 
  142. File: gmp.info,  Node: Installing GMP,  Next: GMP Basics,  Prev: Introduction to GMP,  Up: Top
  143.  
  144. Installing GMP
  145. **************
  146.  
  147. GMP has an autoconf/automake/libtool based configuration system.  On a
  148. Unix-like system a basic build can be done with
  149.  
  150.      ./configure
  151.      make
  152.  
  153. Some self-tests can be run with
  154.  
  155.      make check
  156.  
  157. And you can install (under `/usr/local' by default) with
  158.  
  159.      make install
  160.  
  161. If you experience problems, please report them to <bug-gmp@gnu.org>.
  162. (*Note Reporting Bugs::, for information on what to include in useful
  163. bug reports.)
  164.  
  165. * Menu:
  166.  
  167. * Build Options::
  168. * ABI and ISA::
  169. * Notes for Package Builds::
  170. * Notes for Particular Systems::
  171. * Known Build Problems::
  172.  
  173. 
  174. File: gmp.info,  Node: Build Options,  Next: ABI and ISA,  Prev: Installing GMP,  Up: Installing GMP
  175.  
  176. Build Options
  177. =============
  178.  
  179. All the usual autoconf configure options are available, run `./configure
  180. --help' for a summary.
  181.  
  182. Non-Unix Systems
  183.      `configure' needs various Unix-like tools installed.  On an MS-DOS
  184.      system cygwin or djgpp should work.  It might be possible to build
  185.      without the help of `configure', certainly all the code is there,
  186.      but unfortunately you'll be on your own.
  187.  
  188. Object Directory
  189.      To compile in a separate object directory, `cd' to that directory,
  190.      and prefix the configure command with the path to the GMP source
  191.      directory.  For example `../src/gmp/configure'.  Not all `make'
  192.      programs have the necessary features (`VPATH') to support this.
  193.      In particular, SunOS and Slowaris `make' have bugs that make them
  194.      unable to build from a separate object directory.  Use GNU `make'
  195.      instead.
  196.  
  197. `--disable-shared', `--disable-static'
  198.      By default both shared and static libraries are built (where
  199.      possible), but one or other can be disabled.  Shared libraries are
  200.      very slightly slower, having a small cost on each function call,
  201.      but result in smaller executables and permit code sharing between
  202.      separate running processes.
  203.  
  204. `--target=CPU-VENDOR-OS'
  205.      The build target can be specified in the usual way, for either
  206.      native or cross compilation.
  207.  
  208.      If `--target' isn't given, `./configure' builds for the host
  209.      system as determined by `./config.guess'.  On some systems this
  210.      can't distinguish between different CPUs in a family, and you
  211.      should check the guess.  Running `./config.guess' on the target
  212.      system will also show the relevant `VENDOR-OS', if you don't
  213.      already know what it should be.
  214.  
  215.      In general, if you want a library that runs as fast as possible,
  216.      you should configure GMP for the exact CPU type your system uses.
  217.      However, this may mean the binaries won't run on older members of
  218.      the family, and might run slower on other members, older or newer.
  219.      The best idea is always to build GMP for the exact machine type
  220.      you intend to run it on.
  221.  
  222.      The following CPU targets have specific assembly code support.  See
  223.      `configure.in' for which `mpn' subdirectories get used by each.
  224.  
  225.         * Alpha: `alpha', `alphaev5', `alphaev6'
  226.  
  227.         * Hitachi: `sh', `sh2'
  228.  
  229.         * HPPA: `hppa1.0', `hppa1.1', `hppa2.0', `hppa2.0w'
  230.  
  231.         * MIPS: `mips', `mips3',
  232.  
  233.         * Motorola: `m68000', `m68k', `m88k', `m88110'
  234.  
  235.         * POWER: `power1', `power2', `power2sc', `powerpc', `powerpc64'
  236.  
  237.         * SPARC: `sparc', `sparcv8', `microsparc', `supersparc',
  238.           `sparcv9', `ultrasparc', `sparc64'
  239.  
  240.         * 80x86 family: `i386', `i486', `i586', `pentium', `pentiummmx',
  241.           `pentiumpro', `pentium2', `pentium3', `k6', `k62', `k63',
  242.           `athlon'
  243.  
  244.         * Other: `a29k', `arm', `clipper', `i960', `ns32k', `pyramid',
  245.           `vax', `z8k'
  246.  
  247.      CPUs not listed use generic C code.  If some of the assembly code
  248.      causes problems, the generic C code can be selected with CPU
  249.      `none'.
  250.  
  251. `CC', `CFLAGS'
  252.      The C compiler used is chosen from among some likely candidates,
  253.      with GCC normally preferred if it's present.  The usual
  254.      `CC=whatever' can be passed to `./configure' to choose something
  255.      different.
  256.  
  257.      For some configurations specific compiler flags are set based on
  258.      the target CPU and compiler, see `CFLAGS' in the generated
  259.      `Makefile's.  The usual `CFLAGS="-whatever"' can be passed to
  260.      `./configure' to use something different or to set good flags for
  261.      systems GMP doesn't otherwise know.
  262.  
  263.      Note that if `CC' is set then `CFLAGS' must also be set.  This
  264.      applies even if `CC' is merely one of the choices GMP would make
  265.      itself.  This may change in a future release.
  266.  
  267. `--disable-alloca'
  268.      By default, GMP allocates temporary workspace using `alloca' if
  269.      that function is available, or `malloc' if not.  If you're working
  270.      with large numbers and `alloca' overflows the available stack
  271.      space, you can build with `--disable-alloca' to use `malloc'
  272.      instead.  `malloc' will probably be slightly slower than `alloca'.
  273.  
  274.      When not using `alloca', it's actually the allocation function
  275.      selected with `mp_set_memory_functions' that's used, this being
  276.      `malloc' by default.  *Note Custom Allocation::.
  277.  
  278.      Depending on your system, the only indication of stack overflow
  279.      might be a segmentation violation.  It might be possible to
  280.      increase available stack space with `limit', `ulimit' or
  281.      `setrlimit', or under DJGPP with `stubedit' or `_stklen'.
  282.  
  283. `--enable-fft'
  284.      By default multiplications are done using Karatsuba and 3-way
  285.      Toom-Cook algorithms, but a Fermat FFT can be enabled, for use on
  286.      large to very large operands.  Currently the FFT is recommended
  287.      only for knowledgeable users who check the algorithm thresholds
  288.      for their CPU.
  289.  
  290. `--enable-mpbsd'
  291.      The Berkeley MP compatibility library (`libmp.a') and header file
  292.      (`mp.h') are built and installed only if `--enable-mpbsd' is used.
  293.      *Note BSD Compatible Functions::.
  294.  
  295. `MPN_PATH'
  296.      Various assembler versions of mpn subroutines are provided, and,
  297.      for a given CPU target, a search is made though a path to choose a
  298.      version of each.  For example `sparcv8' has path `"sparc32/v8
  299.      sparc32 generic"', which means it looks first for v8 code, falls
  300.      back on plain sparc32, and finally falls back on generic C.
  301.      Knowledgeable users with special requirements can specify a path
  302.      with `MPN_PATH="dir list"'.  This will normally be unnecessary
  303.      because all sensible paths should be available under one or other
  304.      CPU target.
  305.  
  306. Demonstration Programs
  307.      The `demos' subdirectory has some sample programs using GMP.  These
  308.      aren't built or installed, but there's a `Makefile' with rules for
  309.      them.  For instance, `make pexpr' and then `./pexpr 68^975+10'.
  310.  
  311. Documentation
  312.      The document you're now reading is `gmp.texi'.  The usual automake
  313.      targets are available to make `gmp.ps' and/or `gmp.dvi'.  Some
  314.      supplementary notes can be found in the `doc' subdirectory.
  315.  
  316. 
  317. File: gmp.info,  Node: ABI and ISA,  Next: Notes for Package Builds,  Prev: Build Options,  Up: Installing GMP
  318.  
  319. ABI and ISA
  320. ===========
  321.  
  322.    ABI (Application Binary Interface) refers to the calling conventions
  323. between functions, meaning what registers are used and what sizes the
  324. various C data types are.  ISA (Instruction Set Architecture) refers to
  325. the instructions and registers a CPU has available.
  326.  
  327.    Some 64-bit ISA CPUs have both a 64-bit ABI and a 32-bit ABI
  328. defined, the latter for compatibility with older CPUs in the family.
  329. GMP chooses the best ABI available for a given target system, and this
  330. generally gives significantly greater speed.
  331.  
  332.    The burden is on application programs and cooperating libraries to
  333. ensure they match the ABI chosen by GMP.  Fortunately this presents a
  334. difficulty only on a few systems, and if you have one of them then the
  335. performance gains are enough to make it worth the trouble.
  336.  
  337.    Some of what's described in this section may change in future
  338. releases of GMP.
  339.  
  340. HPPA 2.0
  341.      CPU target `hppa2.0' uses the hppa2.0n 32-bit ABI, but either a
  342.      32-bit or 64-bit limb.
  343.  
  344.      A 64-bit limb is available on HP-UX 10 or up when using `c89'.  No
  345.      `gcc' support is planned for 64-bit operations in this ABI.
  346.      Applications must be compiled with the same options as GMP, which
  347.      means
  348.  
  349.           c89  +DA2.0 +e -D_LONG_LONG_LIMB
  350.  
  351.      A 32-bit limb is used in other cases, and no special compiler
  352.      options are needed.
  353.  
  354.      CPU target `hppa2.0w' uses the hppa2.0w 64-bit ABI, which is
  355.      available on HP-UX 11 or up when using `c89'.  `gcc' support for
  356.      this is in progress.  Applications must be compiled for the same
  357.      ABI, which means
  358.  
  359.           c89  +DD64
  360.  
  361. MIPS 3 and 4 under IRIX 6
  362.      Targets `mips*-*-irix6*' use the n32 ABI and a 64-bit limb.
  363.      Applications must be compiled for the same ABI, which means either
  364.  
  365.           gcc  -mabi=n32
  366.           cc   -n32
  367.  
  368. PowerPC 64
  369.      CPU target `powerpc64' uses either the 32-bit ABI or the AIX
  370.      64-bit ABI.  The latter is used on targets `powerpc64-*-aix*' and
  371.      applications must be compiled using either
  372.  
  373.           gcc  -maix64
  374.           xlc  -q64
  375.  
  376.      On other systems the 32-bit ABI is used, but with 64-bit limbs
  377.      provided by `long long' in `gcc'.  Applications must be compiled
  378.      using
  379.  
  380.           gcc  -D_LONG_LONG_LIMB
  381.  
  382. Sparc V9
  383.      On a sparc v9 CPU, either the v8plus 32-bit ABI or v9 64-bit ABI
  384.      is used.  Targets `ultrasparc*-*-solaris2.[7-9]',
  385.      `sparcv9-*-solaris2.[7-9]' and `sparc64-*-linux*' use the v9 ABI,
  386.      if the compiler supports it.  Other targets use the v8plus ABI
  387.      (but with as much of the v9 ISA as possible in the circumstances).
  388.      Note that Solaris prior to 2.7 doesn't save all registers
  389.      properly, and hence uses the v8plus ABI.
  390.  
  391.      For the v8plus ABI, applications can be compiled with either
  392.  
  393.           gcc  -mv8plus
  394.           cc   -xarch=v8plus
  395.  
  396.      For the v9 ABI, applications must be compiled with either
  397.  
  398.           gcc  -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9
  399.           cc   -xarch=v9
  400.  
  401.      Don't be confused by the names of these options, they're called
  402.      `arch' but they effectively control the ABI.
  403.  
  404. 
  405. File: gmp.info,  Node: Notes for Package Builds,  Next: Notes for Particular Systems,  Prev: ABI and ISA,  Up: Installing GMP
  406.  
  407. Notes for Package Builds
  408. ========================
  409.  
  410.    GMP should present no great difficulties for packaging in a binary
  411. distribution.
  412.  
  413.    Libtool is used to build the library and `-version-info' is set
  414. appropriately, having started from `3:0:0' in GMP 3.0.  The GMP 3 series
  415. will be upwardly binary compatible in each release, but may be adding
  416. additional function interfaces.  On systems where libtool versioning is
  417. not fully checked by the loader, an auxiliary mechanism may be needed
  418. to express that a dynamic linked application depends on a new enough
  419. minor version of GMP.
  420.  
  421.    When building a package for a CPU family, care should be taken to use
  422. `--target' to choose the least common denominator among the CPUs which
  423. might use the package.  For example this might necessitate `i386' for
  424. x86s, or plain `sparc' (meaning V7) for SPARCs.
  425.  
  426.    Users who care about speed will want GMP built for their exact CPU
  427. type, to make use of the available optimizations.  Providing a way to
  428. suitably rebuild a package may be useful.  This could be as simple as
  429. making it possible for a user to omit `--target' in a build so
  430. `./config.guess' will detect the CPU.  But a way to manually specify a
  431. `--target' will be wanted for systems where `./config.guess' is inexact.
  432.  
  433. 
  434. File: gmp.info,  Node: Notes for Particular Systems,  Next: Known Build Problems,  Prev: Notes for Package Builds,  Up: Installing GMP
  435.  
  436. Notes for Particular Systems
  437. ============================
  438.  
  439. AIX 4.3
  440.      Targets `*-*-aix4.[3-9]*' have shared libraries disabled since
  441.      they seem to fail on AIX 4.3.
  442.  
  443. OpenBSD 2.6
  444.      `m4' in this release of OpenBSD has a bug in `eval' that makes it
  445.      unsuitable for `.asm' file processing.  `./configure' will detect
  446.      the problem and either abort or choose another m4 in the `PATH'.
  447.      The bug is fixed in OpenBSD 2.7, so either upgrade or use GNU m4.
  448.  
  449. Sparc V8
  450.      Using CPU target `sparcv8' or `supersparc' on relevant systems will
  451.      give a significant performance increase over the V7 code.
  452.  
  453. SunOS 4
  454.      `/usr/bin/m4' lacks various features needed to process `.asm'
  455.      files, and instead `./configure' will automatically use
  456.      `/usr/5bin/m4', which we believe is always available (if not then
  457.      use GNU m4).
  458.  
  459. x86 Pentium and PentiumPro
  460.      The Intel Pentium P5 code is good for its intended P5, but quite
  461.      slow when run on Intel P6 class chips (PPro, P-II, P-III).  `i386'
  462.      is a better choice if you're making binaries that must run on both.
  463.  
  464. x86 MMX and old GAS
  465.      Old versions of GAS don't support MMX instructions, in particular
  466.      version 1.92.3 that comes with FreeBSD 2.2.8 doesn't (and
  467.      unfortunately there's no newer assembler for that system).
  468.  
  469.      If the target CPU has MMX code but the assembler doesn't support
  470.      it, a warning is given and non-MMX code is used instead.  This
  471.      will be an inferior build, since the MMX code that's present is
  472.      there because it's faster than the corresponding plain integer
  473.      code.
  474.  
  475. x86 GCC 2.95.2 `-march=pentiumpro'
  476.      GCC 2.95.2 miscompiles `mpz/powm.c' when `-march=pentiumpro' is
  477.      used, so that option is omitted from the `CFLAGS' chosen for
  478.      relevant CPUs.  The problem is believed to be fixed in GCC 2.96.
  479.  
  480. 
  481. File: gmp.info,  Node: Known Build Problems,  Prev: Notes for Particular Systems,  Up: Installing GMP
  482.  
  483. Known Build Problems
  484. ====================
  485.  
  486.    You might find more up-to-date information at
  487. `http://www.swox.com/gmp/'.
  488.  
  489. Generic C on a 64-bit system
  490.      When making a generic C build using `--target=none' on a 64-bit
  491.      system (meaning where `unsigned long' is 64 bits),
  492.      `BITS_PER_MP_LIMB', `BITS_PER_LONGINT' and `BYTES_PER_MP_LIMB' in
  493.      `mpn/generic/gmp-mparam.h' need to be changed to 64 and 8.  This
  494.      will hopefully be automated in a future version of GMP.
  495.  
  496. NeXT prior to 3.3
  497.      The system compiler on old versions of NeXT was a massacred and
  498.      old GCC, even if it called itself `cc'.  This compiler cannot be
  499.      used to build GMP, you need to get a real GCC, and install that
  500.      before you compile GMP.  (NeXT may have fixed this in release 3.3
  501.      of their system.)
  502.  
  503. POWER and PowerPC
  504.      Bugs in GCC 2.7.2 (and 2.6.3) mean it can't be used to compile GMP
  505.      on POWER or PowerPC.  If you want to use GCC for these machines,
  506.      get GCC 2.7.2.1 (or later).
  507.  
  508. Sequent Symmetry
  509.      Use the GNU assembler instead of the system assembler, since the
  510.      latter has serious bugs.
  511.  
  512. Stripped Libraries
  513.      GNU binutils `strip' should not be used on the static libraries
  514.      `libgmp.a' and `libmp.a', neither directly nor via `make
  515.      install-strip'.  It can be used on the shared libraries
  516.      `libgmp.so' and `libmp.so' though.
  517.  
  518.      Currently (binutils 2.10.0), `strip' extracts archives into a
  519.      single directory, but GMP contains multiple object files of the
  520.      same name (eg. three versions of `init.o'), and they overwrite
  521.      each other, leaving only the one that happens to be last.
  522.  
  523.      If stripped static libraries are wanted, the suggested workaround
  524.      is to build normally, strip the separate object files, and do
  525.      another `make all' to rebuild.  Alternately `CFLAGS' with `-g'
  526.      omitted can always be used if it's just debugging which is
  527.      unwanted.
  528.  
  529. SunOS 4 Native Tools
  530.      The setting for `GSYM_PREFIX' in `config.m4' may be incorrectly
  531.      determined when using the native `grep', leading at link-time to
  532.      undefined symbols like `___gmpn_add_n'.  To fix this, after running
  533.      `./configure', change the relevant line in `config.m4' to
  534.      `define(<GSYM_PREFIX>, <_>)'.
  535.  
  536.      The `ranlib' command will need to be run manually when building a
  537.      static library with the native `ar'.  After `make', run `ranlib
  538.      .libs/libgmp.a', and when using `--enable-mpbsd' run `ranlib
  539.      .libs/libmp.a' too.
  540.  
  541. `version.c' compilation
  542.      The current `./configure' relies on certain features of `sed' that
  543.      some old systems don't have.  One symptom is `VERSION' not being
  544.      set correctly in the generated `config.h', leading to `version.c'
  545.      failing to compile.  Irix 5.3, MIPS RISC/OS and Ultrix 4.4 are
  546.      believed to be affected.  GNU `sed' is recommended, though it
  547.      might be possible to build by editing `config.h' manually instead.
  548.  
  549. VAX running Ultrix
  550.      You need to build and install the GNU assembler before you compile
  551.      GMP.  The VAX assembly in GMP uses an instruction (`jsobgtr') that
  552.      cannot be assembled by the Ultrix assembler.
  553.  
  554. 
  555. File: gmp.info,  Node: GMP Basics,  Next: Reporting Bugs,  Prev: Installing GMP,  Up: Top
  556.  
  557. GMP Basics
  558. **********
  559.  
  560.    All declarations needed to use GMP are collected in the include file
  561. `gmp.h'.  It is designed to work with both C and C++ compilers.
  562.  
  563.    *Using functions, macros, data types, etc. not documented in this
  564. manual is strongly discouraged.  If you do so your application is
  565. guaranteed to be incompatible with future versions of GMP.*
  566.  
  567. * Menu:
  568.  
  569. * Nomenclature and Types::          Which data types are there?
  570. * Function Classes::                How the functions are organized.
  571. * GMP Variable Conventions::         Some rules and hints about variables.
  572. * GMP and Reentrancy::               What about reentrancy?
  573. * Useful Macros and Constants::      Convenient helpers.
  574. * Compatibility with older versions::    Compatibility issues.
  575. * Getting the Latest Version of GMP::      How to get the software.
  576.  
  577. 
  578. File: gmp.info,  Node: Nomenclature and Types,  Next: Function Classes,  Prev: GMP Basics,  Up: GMP Basics
  579.  
  580. Nomenclature and Types
  581. ======================
  582.  
  583. In this manual, "integer" usually means a multiple precision integer, as
  584. defined by the GMP library.  The C data type for such integers is
  585. `mpz_t'.  Here are some examples of how to declare such integers:
  586.  
  587.      mpz_t sum;
  588.      
  589.      struct foo { mpz_t x, y; };
  590.      
  591.      mpz_t vec[20];
  592.  
  593. "Rational number" means a multiple precision fraction.  The C data type
  594. for these fractions is `mpq_t'.  For example:
  595.  
  596.      mpq_t quotient;
  597.  
  598. "Floating point number" or "Float" for short, is an arbitrary precision
  599. mantissa with a limited precision exponent.  The C data type for such
  600. objects is `mpf_t'.
  601.  
  602. A "limb" means the part of a multi-precision number that fits in a
  603. single word.  (We chose this word because a limb of the human body is
  604. analogous to a digit, only larger, and containing several digits.)
  605. Normally a limb contains 32 or 64 bits.  The C data type for a limb is
  606. `mp_limb_t'.
  607.  
  608. 
  609. File: gmp.info,  Node: Function Classes,  Next: GMP Variable Conventions,  Prev: Nomenclature and Types,  Up: GMP Basics
  610.  
  611. Function Classes
  612. ================
  613.  
  614.    There are six classes of functions in the GMP library:
  615.  
  616.   1. Functions for signed integer arithmetic, with names beginning with
  617.      `mpz_'.  The associated type is `mpz_t'.  There are about 100
  618.      functions in this class.
  619.  
  620.   2. Functions for rational number arithmetic, with names beginning with
  621.      `mpq_'.  The associated type is `mpq_t'.  There are about 20
  622.      functions in this class, but the functions in the previous class
  623.      can be used for performing arithmetic on the numerator and
  624.      denominator separately.
  625.  
  626.   3. Functions for floating-point arithmetic, with names beginning with
  627.      `mpf_'.  The associated type is `mpf_t'.  There are about 50
  628.      functions is this class.
  629.  
  630.   4. Functions compatible with Berkeley GMP, such as `itom', `madd', and
  631.      `mult'.  The associated type is `MINT'.
  632.  
  633.   5. Fast low-level functions that operate on natural numbers.  These
  634.      are used by the functions in the preceding groups, and you can
  635.      also call them directly from very time-critical user programs.
  636.      These functions' names begin with `mpn_'.  There are about 30
  637.      (hard-to-use) functions in this class.
  638.  
  639.      The associated type is array of `mp_limb_t'.
  640.  
  641.   6. Miscellaneous functions.  Functions for setting up custom
  642.      allocation and functions for generating random numbers.
  643.  
  644. 
  645. File: gmp.info,  Node: GMP Variable Conventions,  Next: GMP and Reentrancy,  Prev: Function Classes,  Up: GMP Basics
  646.  
  647. GMP Variable Conventions
  648. ========================
  649.  
  650.    As a general rule, all GMP functions expect output arguments before
  651. input arguments.  This notation is based on an analogy with the
  652. assignment operator.  (The BSD MP compatibility functions disobey this
  653. rule, having the output argument(s) last.)
  654.  
  655.    GMP lets you use the same variable for both input and output in one
  656. call.  For example, the main function for integer multiplication,
  657. `mpz_mul', can be used to square `x' and put the result back in `x' with
  658.  
  659.      mpz_mul (x, x, x);
  660.  
  661.    Before you can assign to a GMP variable, you need to initialize it
  662. by calling one of the special initialization functions.  When you're
  663. done with a variable, you need to clear it out, using one of the
  664. functions for that purpose.  Which function to use depends on the type
  665. of variable.  See the chapters on integer functions, rational number
  666. functions, and floating-point functions for details.
  667.  
  668.    A variable should only be initialized once, or at least cleared out
  669. between each initialization.  After a variable has been initialized, it
  670. may be assigned to any number of times.
  671.  
  672.    For efficiency reasons, avoid initializing and clearing out a GMP
  673. variable in a loop.  Instead, initialize it before entering the loop,
  674. and clear it out after the loop has exited.
  675.  
  676.    GMP variables are small, containing only a couple of sizes, and
  677. pointers to allocated data.  Once you have initialized a GMP variable,
  678. you don't need to worry about space allocation.  All functions in GMP
  679. automatically allocate additional space when a variable does not
  680. already have enough.  They do not, however, reduce the space when a
  681. smaller value is stored.  Most of the time this policy is best, since
  682. it avoids frequent re-allocation.
  683.  
  684.    When a variable of type `mpz_t' is used as a function parameter, it's
  685. effectively a call-by-reference, meaning anything the function does to
  686. it will be be done to the original in the caller.  When a function is
  687. going to return an `mpz_t' result, it should provide a separate
  688. parameter or parameters that it sets, like the GMP library functions
  689. do.  A `return' of an `mpz_t' doesn't return the object, only a pointer
  690. to it, and this is almost certainly not what you want.  All this
  691. applies to `mpq_t' and `mpf_t' too.
  692.  
  693.    Here's an example function accepting an `mpz_t' parameter, doing a
  694. certain calculation, and returning a result.
  695.  
  696.      void
  697.      myfunction (mpz_t result, mpz_t param, unsigned long n)
  698.      {
  699.        unsigned long  i;
  700.      
  701.        mpz_mul_ui (result, param, n);
  702.        for (i = 1; i < n; i++)
  703.          mpz_add_ui (result, result, i*7);
  704.      }
  705.      
  706.      int
  707.      main (void)
  708.      {
  709.        mpz_t  r, n;
  710.        mpz_init (r);
  711.        mpz_init_set_str (n, "123456", 0);
  712.      
  713.        myfunction (r, n, 20L);
  714.        mpz_out_str (stdout, 10, r); printf ("\n");
  715.      
  716.        return 0;
  717.      }
  718.  
  719.    This example will work if `result' and `param' are the same
  720. variable, just like the library functions.  But sometimes this is
  721. tricky to arrange, and an application might not want to bother for its
  722. own subroutines.
  723.  
  724.    `mpz_t' is actually implemented as a one-element array of a certain
  725. structure type.  This is why using it to declare a variable gives an
  726. object with the fields GMP needs, but then using it as a parameter
  727. passes a pointer to the object.  Note that the actual contents of an
  728. `mpz_t' are for internal use only and you should not access them
  729. directly if you want your code to be compatible with future GMP
  730. releases.
  731.  
  732. 
  733. File: gmp.info,  Node: GMP and Reentrancy,  Next: Useful Macros and Constants,  Prev: GMP Variable Conventions,  Up: GMP Basics
  734.  
  735. GMP and Reentrancy
  736. ==================
  737.  
  738.    The GMP code is reentrant and thread-safe, with some exceptions:
  739.  
  740.    * The function `mpf_set_default_prec' saves the selected precision in
  741.      a global variable.
  742.  
  743.    * The function `mp_set_memory_functions' uses several global
  744.      variables for storing the selected memory allocation functions.
  745.  
  746.    * If the memory allocation functions set by a call to
  747.      `mp_set_memory_functions' (or `malloc' and friends by default) are
  748.      not reentrant, GMP will not be reentrant either.
  749.  
  750.    * The old random number functions (`mpz_random', etc) use a random
  751.      number generator from the C library, usually `mrand48' or
  752.      `random'.  These routines are not reentrant, since they rely on
  753.      global state.  (However the newer random number functions that
  754.      accept a `gmp_randstate_t' parameter are reentrant.)
  755.  
  756.    * If `alloca' is not available, or GMP is configured with
  757.      `--disable-alloca', the library is not reentrant, due to the
  758.      current implementation of `stack-alloc.c'.  In the generated
  759.      `config.h', `USE_STACK_ALLOC' set to 1 will mean not reentrant.
  760.  
  761. 
  762. File: gmp.info,  Node: Useful Macros and Constants,  Next: Compatibility with older versions,  Prev: GMP and Reentrancy,  Up: GMP Basics
  763.  
  764. Useful Macros and Constants
  765. ===========================
  766.  
  767.  - Global Constant: const int mp_bits_per_limb
  768.      The number of bits per limb.
  769.  
  770.  - Macro: __GNU_MP_VERSION
  771.  - Macro: __GNU_MP_VERSION_MINOR
  772.  - Macro: __GNU_MP_VERSION_PATCHLEVEL
  773.      The major and minor GMP version, and patch level, respectively, as
  774.      integers.  For GMP i.j, these numbers will be i, j, and 0,
  775.      respectively.  For GMP i.j.k, these numbers will be i, j, and k,
  776.      respectively.
  777.  
  778. 
  779. File: gmp.info,  Node: Compatibility with older versions,  Next: Getting the Latest Version of GMP,  Prev: Useful Macros and Constants,  Up: GMP Basics
  780.  
  781. Compatibility with older versions
  782. =================================
  783.  
  784.    This version of GMP is upwardly binary compatible with versions 3.0
  785. and 3.0.1, and upwardly compatible at the source level with versions
  786. 2.0, 2.0.1, and 2.0.2, with the following exceptions.
  787.  
  788.    * `mpn_gcd' had its source arguments swapped as of GMP 3.0 for
  789.      consistency with other `mpn' functions.
  790.  
  791.    * `mpf_get_prec' counted precision slightly differently in GMP 3.0
  792.      and 3.0.1, but in 3.1 has reverted to the 2.0.x style.
  793.  
  794.  
  795.    There are a number of compatibility issues between GMP 1 and GMP 2
  796. that of course also apply when porting applications from GMP 1 to GMP
  797. 3.  Please see the GMP 2 manual for details.
  798.  
  799. 
  800. File: gmp.info,  Node: Getting the Latest Version of GMP,  Prev: Compatibility with older versions,  Up: GMP Basics
  801.  
  802. Getting the Latest Version of GMP
  803. =================================
  804.  
  805.    The latest version of the GMP library is available at
  806. `ftp://ftp.gnu.org/pub/gnu/gmp'.  Many sites around the world mirror
  807. `ftp.gnu.org'; please use a mirror site near you, see
  808. `http://www.gnu.org/order/ftp.html'.
  809.  
  810. 
  811. File: gmp.info,  Node: Reporting Bugs,  Next: Integer Functions,  Prev: GMP Basics,  Up: Top
  812.  
  813. Reporting Bugs
  814. **************
  815.  
  816.    If you think you have found a bug in the GMP library, please
  817. investigate it and report it.  We have made this library available to
  818. you, and it is not too much to ask you to report the bugs you find.
  819. Before you report a bug, you may want to check
  820. `http://www.swox.com/gmp/' for patches for this release.
  821.  
  822.    Please include the following in any report,
  823.  
  824.    * The GMP version number, and if pre-packaged or patched then say so.
  825.  
  826.    * A test program that makes it possible for us to reproduce the bug.
  827.      Include instructions on how to run the program.
  828.  
  829.    * A description of what is wrong.  If the results are incorrect, in
  830.      what way.  If you get a crash, say so.
  831.  
  832.    * If you get a crash, include a stack backtrace from the debugger if
  833.      it's informative (`where' in `gdb', or `$C' in `adb').
  834.  
  835.    * *Please do not send core dumps, executables or `strace's.*
  836.  
  837.    * The configuration options you used when building GMP, if any.
  838.  
  839.    * The name of the compiler and its version.  For `gcc', get the
  840.      version with `gcc -v', otherwise perhaps `what `which cc`', or
  841.      similar.
  842.  
  843.    * The output from running `uname -a'.
  844.  
  845.    * The output from running `./config.guess'.
  846.  
  847.    * If the bug is related to `configure', then the contents of
  848.      `config.log'.
  849.  
  850.    * If the bug is related to an `asm' file not assembling, then the
  851.      contents of `config.m4'.
  852.  
  853.    It is not uncommon that an observed problem is actually due to a bug
  854. in the compiler; the GMP code tends to explore interesting corners in
  855. compilers.
  856.  
  857.    If your bug report is good, we will do our best to help you get a
  858. corrected version of the library; if the bug report is poor, we won't
  859. do anything about it (except maybe ask you to send a better report).
  860.  
  861.    Send your report to: <bug-gmp@gnu.org>.
  862.  
  863.    If you think something in this manual is unclear, or downright
  864. incorrect, or if the language needs to be improved, please send a note
  865. to the same address.
  866.  
  867. 
  868. File: gmp.info,  Node: Integer Functions,  Next: Rational Number Functions,  Prev: Reporting Bugs,  Up: Top
  869.  
  870. Integer Functions
  871. *****************
  872.  
  873.    This chapter describes the GMP functions for performing integer
  874. arithmetic.  These functions start with the prefix `mpz_'.
  875.  
  876.    GMP integers are stored in objects of type `mpz_t'.
  877.  
  878. * Menu:
  879.  
  880. * Initializing Integers::
  881. * Assigning Integers::
  882. * Simultaneous Integer Init & Assign::
  883. * Converting Integers::
  884. * Integer Arithmetic::
  885. * Integer Division::
  886. * Integer Exponentiation::
  887. * Integer Roots::
  888. * Number Theoretic Functions::
  889. * Integer Comparisons::
  890. * Integer Logic and Bit Fiddling::
  891. * I/O of Integers::
  892. * Integer Random Numbers::
  893. * Miscellaneous Integer Functions::
  894.  
  895. 
  896. File: gmp.info,  Node: Initializing Integers,  Next: Assigning Integers,  Prev: Integer Functions,  Up: Integer Functions
  897.  
  898. Initialization Functions
  899. ========================
  900.  
  901.    The functions for integer arithmetic assume that all integer objects
  902. are initialized.  You do that by calling the function `mpz_init'.
  903.  
  904.  - Function: void mpz_init (mpz_t INTEGER)
  905.      Initialize INTEGER with limb space and set the initial numeric
  906.      value to 0.  Each variable should normally only be initialized
  907.      once, or at least cleared out (using `mpz_clear') between each
  908.      initialization.
  909.  
  910.    Here is an example of using `mpz_init':
  911.  
  912.      {
  913.        mpz_t integ;
  914.        mpz_init (integ);
  915.        ...
  916.        mpz_add (integ, ...);
  917.        ...
  918.        mpz_sub (integ, ...);
  919.      
  920.        /* Unless the program is about to exit, do ... */
  921.        mpz_clear (integ);
  922.      }
  923.  
  924. As you can see, you can store new values any number of times, once an
  925. object is initialized.
  926.  
  927.  - Function: void mpz_clear (mpz_t INTEGER)
  928.      Free the limb space occupied by INTEGER.  Make sure to call this
  929.      function for all `mpz_t' variables when you are done with them.
  930.  
  931.  - Function: void * _mpz_realloc (mpz_t INTEGER, mp_size_t NEW_ALLOC)
  932.      Change the limb space allocation to NEW_ALLOC limbs.  This
  933.      function is not normally called from user code, but it can be used
  934.      to give memory back to the heap, or to increase the space of a
  935.      variable to avoid repeated automatic re-allocation.
  936.  
  937.  - Function: void mpz_array_init (mpz_t INTEGER_ARRAY[], size_t
  938.           ARRAY_SIZE, mp_size_t FIXED_NUM_BITS)
  939.      Allocate *fixed* limb space for all ARRAY_SIZE integers in
  940.      INTEGER_ARRAY.  The fixed allocation for each integer in the array
  941.      is enough to store FIXED_NUM_BITS.  If the fixed space will be
  942.      insufficient for storing the result of a subsequent calculation,
  943.      the result is unpredictable.
  944.  
  945.      This function is useful for decreasing the working set for some
  946.      algorithms that use large integer arrays.
  947.  
  948.      There is no way to de-allocate the storage allocated by this
  949.      function.  Don't call `mpz_clear'!
  950.  
  951. 
  952. File: gmp.info,  Node: Assigning Integers,  Next: Simultaneous Integer Init & Assign,  Prev: Initializing Integers,  Up: Integer Functions
  953.  
  954. Assignment Functions
  955. ====================
  956.  
  957.    These functions assign new values to already initialized integers
  958. (*note Initializing Integers::).
  959.  
  960.  - Function: void mpz_set (mpz_t ROP, mpz_t OP)
  961.  - Function: void mpz_set_ui (mpz_t ROP, unsigned long int OP)
  962.  - Function: void mpz_set_si (mpz_t ROP, signed long int OP)
  963.  - Function: void mpz_set_d (mpz_t ROP, double OP)
  964.  - Function: void mpz_set_q (mpz_t ROP, mpq_t OP)
  965.  - Function: void mpz_set_f (mpz_t ROP, mpf_t OP)
  966.      Set the value of ROP from OP.
  967.  
  968.  - Function: int mpz_set_str (mpz_t ROP, char *STR, int BASE)
  969.      Set the value of ROP from STR, a '\0'-terminated C string in base
  970.      BASE.  White space is allowed in the string, and is simply
  971.      ignored.  The base may vary from 2 to 36.  If BASE is 0, the
  972.      actual base is determined from the leading characters: if the
  973.      first two characters are `0x' or `0X', hexadecimal is assumed,
  974.      otherwise if the first character is `0', octal is assumed,
  975.      otherwise decimal is assumed.
  976.  
  977.      This function returns 0 if the entire string up to the '\0' is a
  978.      valid number in base BASE.  Otherwise it returns -1.
  979.  
  980.      [It turns out that it is not entirely true that this function
  981.      ignores white-space.  It does ignore it between digits, but not
  982.      after a minus sign or within or after "0x".  We are considering
  983.      changing the definition of this function, making it fail when
  984.      there is any white-space in the input, since that makes a lot of
  985.      sense.  Please tell us your opinion about this change.  Do you
  986.      really want it to accept "3 14" as meaning 314 as it does now?]
  987.  
  988.  - Function: void mpz_swap (mpz_t ROP1, mpz_t ROP2)
  989.      Swap the values ROP1 and ROP2 efficiently.
  990.  
  991. 
  992. File: gmp.info,  Node: Simultaneous Integer Init & Assign,  Next: Converting Integers,  Prev: Assigning Integers,  Up: Integer Functions
  993.  
  994. Combined Initialization and Assignment Functions
  995. ================================================
  996.  
  997.    For convenience, GMP provides a parallel series of
  998. initialize-and-set functions which initialize the output and then store
  999. the value there.  These functions' names have the form `mpz_init_set...'
  1000.  
  1001.    Here is an example of using one:
  1002.  
  1003.      {
  1004.        mpz_t pie;
  1005.        mpz_init_set_str (pie, "3141592653589793238462643383279502884", 10);
  1006.        ...
  1007.        mpz_sub (pie, ...);
  1008.        ...
  1009.        mpz_clear (pie);
  1010.      }
  1011.  
  1012. Once the integer has been initialized by any of the `mpz_init_set...'
  1013. functions, it can be used as the source or destination operand for the
  1014. ordinary integer functions.  Don't use an initialize-and-set function
  1015. on a variable already initialized!
  1016.  
  1017.  - Function: void mpz_init_set (mpz_t ROP, mpz_t OP)
  1018.  - Function: void mpz_init_set_ui (mpz_t ROP, unsigned long int OP)
  1019.  - Function: void mpz_init_set_si (mpz_t ROP, signed long int OP)
  1020.  - Function: void mpz_init_set_d (mpz_t ROP, double OP)
  1021.      Initialize ROP with limb space and set the initial numeric value
  1022.      from OP.
  1023.  
  1024.  - Function: int mpz_init_set_str (mpz_t ROP, char *STR, int BASE)
  1025.      Initialize ROP and set its value like `mpz_set_str' (see its
  1026.      documentation above for details).
  1027.  
  1028.      If the string is a correct base BASE number, the function returns
  1029.      0; if an error occurs it returns -1.  ROP is initialized even if
  1030.      an error occurs.  (I.e., you have to call `mpz_clear' for it.)
  1031.  
  1032. 
  1033. File: gmp.info,  Node: Converting Integers,  Next: Integer Arithmetic,  Prev: Simultaneous Integer Init & Assign,  Up: Integer Functions
  1034.  
  1035. Conversion Functions
  1036. ====================
  1037.  
  1038.    This section describes functions for converting GMP integers to
  1039. standard C types.  Functions for converting _to_ GMP integers are
  1040. described in *Note Assigning Integers:: and *Note I/O of Integers::.
  1041.  
  1042.  - Function: mp_limb_t mpz_getlimbn (mpz_t OP, mp_size_t N)
  1043.      Return limb #N from OP.  This function allows for very efficient
  1044.      decomposition of a number in its limbs.
  1045.  
  1046.      The function `mpz_size' can be used to determine the useful range
  1047.      for N.
  1048.  
  1049.  - Function: unsigned long int mpz_get_ui (mpz_t OP)
  1050.      Return the least significant part from OP.  This function combined
  1051.      with
  1052.      `mpz_tdiv_q_2exp(..., OP, CHAR_BIT*sizeof(unsigned long int))' can
  1053.      be used to decompose an integer into unsigned longs.
  1054.  
  1055.  - Function: signed long int mpz_get_si (mpz_t OP)
  1056.      If OP fits into a `signed long int' return the value of OP.
  1057.      Otherwise return the least significant part of OP, with the same
  1058.      sign as OP.
  1059.  
  1060.      If OP is too large to fit in a `signed long int', the returned
  1061.      result is probably not very useful.  To find out if the value will
  1062.      fit, use the function `mpz_fits_slong_p'.
  1063.  
  1064.  - Function: double mpz_get_d (mpz_t OP)
  1065.      Convert OP to a double.
  1066.  
  1067.  - Function: char * mpz_get_str (char *STR, int BASE, mpz_t OP)
  1068.      Convert OP to a string of digits in base BASE.  The base may vary
  1069.      from 2 to 36.
  1070.  
  1071.      If STR is `NULL', space for the result string is allocated using
  1072.      the default allocation function.
  1073.  
  1074.      If STR is not `NULL', it should point to a block of storage enough
  1075.      large for the result.  To find out the right amount of space to
  1076.      provide for STR, use `mpz_sizeinbase (OP, BASE) + 2'.  The two
  1077.      extra bytes are for a possible minus sign, and for the terminating
  1078.      null character.
  1079.  
  1080.      A pointer to the result string is returned.  This pointer will
  1081.      will either equal STR, or if that is `NULL', will point to the
  1082.      allocated storage.
  1083.  
  1084. 
  1085. File: gmp.info,  Node: Integer Arithmetic,  Next: Integer Division,  Prev: Converting Integers,  Up: Integer Functions
  1086.  
  1087. Arithmetic Functions
  1088. ====================
  1089.  
  1090.  - Function: void mpz_add (mpz_t ROP, mpz_t OP1, mpz_t OP2)
  1091.  - Function: void mpz_add_ui (mpz_t ROP, mpz_t OP1, unsigned long int
  1092.           OP2)
  1093.      Set ROP to OP1 + OP2.
  1094.  
  1095.  - Function: void mpz_sub (mpz_t ROP, mpz_t OP1, mpz_t OP2)
  1096.  - Function: void mpz_sub_ui (mpz_t ROP, mpz_t OP1, unsigned long int
  1097.           OP2)
  1098.      Set ROP to OP1 - OP2.
  1099.  
  1100.  - Function: void mpz_mul (mpz_t ROP, mpz_t OP1, mpz_t OP2)
  1101.  - Function: void mpz_mul_si (mpz_t ROP, mpz_t OP1, long int OP2)
  1102.  - Function: void mpz_mul_ui (mpz_t ROP, mpz_t OP1, unsigned long int
  1103.           OP2)
  1104.      Set ROP to OP1 times OP2.
  1105.  
  1106.  - Function: void mpz_addmul_ui (mpz_t ROP, mpz_t OP1, unsigned long
  1107.           int OP2)
  1108.      Add OP1 times OP2 to ROP.
  1109.  
  1110.  - Function: void mpz_mul_2exp (mpz_t ROP, mpz_t OP1, unsigned long int
  1111.           OP2)
  1112.      Set ROP to OP1 times 2 raised to OP2.  This operation can also be
  1113.      defined as a left shift, OP2 steps.
  1114.  
  1115.  - Function: void mpz_neg (mpz_t ROP, mpz_t OP)
  1116.      Set ROP to -OP.
  1117.  
  1118.  - Function: void mpz_abs (mpz_t ROP, mpz_t OP)
  1119.      Set ROP to the absolute value of OP.
  1120.  
  1121.